/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pimp.organizermanager;

import java.util.*;
/**
 *
 * @author Wilku
 */
public class Transaction extends GlobalEvent{
    private int value;
    private int commission;
    private TransactionSubject transactionSubject;
    private int transactionKind;
    
    private static List<TransactionSubject> transactionSubjects;

    public Transaction(String id, Date transactionDate, String description, int value,  int commission, String transactionSubject, int transactionKind) {
        super(new ID(ID.PATH_SEPARATOR + "Transaction" + id), transactionDate, transactionDate, description);

        this.value = value;
        this.commission = commission;
        this.transactionSubject = new TransactionSubject(transactionSubject);
        this.transactionKind = transactionKind;
    }

    public enum TransactionKind
    {
        CASH,
        TRANSFER,
        CREDIT_CARD,
        CHECK
    }


    @Override
    public Node transformToNode() {
        Node ret = new Node("Transaction");

        super.addGlobalEventFieldsToNode(ret);

        ret.addChild(new Node("value", value) );
        ret.addChild(new Node("commission", commission));
        ret.addChild(new Node("transactionSubject",transactionSubject));
        ret.addChild(new Node("transactionKind",transactionKind));

        return ret;
    }

    public static int getAttributeCount()
    {
        return 5; //zwracamy liczbę posiadanych przez klasę atrybutów. Na razie jest tak, potem będzie bardzie automatycznie
    }
}
